
function getUser() {
  return new Promise((resolve, reject) => {
    $.ajax({
      url: 'http://localhost:8001/user/getList',
      method: 'get',
      success: res => {
        console.log('user', res)
        resolve(res)
      },
      fail: err => {
        reject(err)
      }
    })
  })    
}

function getGoods(userId) {
  return new Promise((resolve, reject) => {
    $.ajax({
      url: 'http://localhost:8001/goods/getList?userId=' + userId,
      method: 'get',
      success: res => {
        console.log('goods', res)
        resolve(res)
      },
      fail: err => {
        reject(err)
      }
    })
  })
}

function getAppraise(goodsId) {
  return new Promise((resolve, reject) => {
    $.ajax({
      url: 'http://localhost:8001/appraise/getList?goodsId=' + goodsId,
      method: 'get',
      success: res => {
        console.log('appraise', res);
        resolve(res)
      },
      fail: err => reject(err)
    })
  })
}

export {getUser, getGoods, getAppraise}